import { Tabs, TabPane } from '@douyinfe/semi-ui'
import NodeType from './NodeType'
import PythonType from './PythonType'
import PythonRun from './PythonRun'
import { useState } from 'react'
import styles from './index.module.scss'

export interface HomeProps {
  isRunning: {
    isRunning: boolean,
    type: string,
  },
  setIsRunning: (value: any) => void,
}

const Home = () => {
  // 记录当前是否有在运行
  const [isRunning, setIsRunning] = useState({ isRunning: false, type: '' })
  return (
    <div className={styles.Home}>
      <Tabs tabPosition="left" type={'line'}>
        <TabPane tab={<span>方式1-模拟人工</span>} itemKey="python">
          {isRunning.isRunning && isRunning.type === 'python' ? <PythonRun setIsRunning={setIsRunning}></PythonRun> : <PythonType isRunning={isRunning} setIsRunning={setIsRunning}></PythonType>}
        </TabPane>
        <TabPane tab={<span>方式2-网络请求</span>} itemKey="node" disabled>
          <NodeType></NodeType>
        </TabPane>
      </Tabs>
    </div>

  )
}

export default Home
